// AppConfig.java
package com.lxt.ScreencastGallery;

/**
 * 应用配置类
 */
public class AppConfig {

    // 显示区域配置
    public static final int DISPLAY_WIDTH = 0; // 0表示使用屏幕宽度
    public static final int DISPLAY_HEIGHT = 0; // 0表示使用屏幕宽度/1.4计算
    public static final int DISPLAY_TOP_MARGIN = 0;
    
    // 缩略图配置
    public static final int THUMBNAIL_COLUMNS = 4;

    // 支持的媒体格式
    public static final String[] SUPPORTED_IMAGE_FORMATS = {
        "jpg", "jpeg", "png", "gif", "bmp", "webp"
    };
    
    public static final String[] SUPPORTED_VIDEO_FORMATS = {
        "mp4", "avi", "mov", "mkv", "3gp", "webm", "flv"
    };
    

    
    // 状态文本显示时间
    public static final int STATUS_TEXT_DURATION = 3000; // 3秒

    /**
     * 检查是否为支持的图片格式
     */
    public static boolean isSupportedImageFormat(String extension) {
        if (extension == null) return false;
        extension = extension.toLowerCase();
        for (String format : SUPPORTED_IMAGE_FORMATS) {
            if (format.equals(extension)) {
                return true;
            }
        }
        return false;
    }
    
    /**
     * 检查是否为支持的视频格式
     */
    public static boolean isSupportedVideoFormat(String extension) {
        if (extension == null) return false;
        extension = extension.toLowerCase();
        for (String format : SUPPORTED_VIDEO_FORMATS) {
            if (format.equals(extension)) {
                return true;
            }
        }
        return false;
    }
    
    /**
     * 获取文件扩展名
     */
    public static String getFileExtension(String fileName) {
        if (fileName == null) return "";
        int lastDotIndex = fileName.lastIndexOf('.');
        if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) {
            return fileName.substring(lastDotIndex + 1);
        }
        return "";
    }
}
